<template>
  <div>
    <Header_h />
    <div class="sq_box_content">
      <bannerInfo :info="info" />
    </div>
    <div class="new_box">
      <div class="container">
        <div class="s_flex s_align_items_start">
          <!-- <leftMenu :menu="menu" :check="active" @checkItem="checkItem" /> -->
          <section class="core_content_left core_content core_content_lefts">
            <div>
              <div class="s_flex s_justify_content_between">
                <div
                  class="
                    sq_tilte3 sq_h3
                    line_h_30
                    sq_tilte_color
                    ft_weight_800
                    sq_tilte_color
                  "
                >
                  {{ list.title }}
                </div>
                <div
                  class="sq_sign_btn sq_content sq_sign_btn3"
                  @click.stop="getUrl()"
                >
                  立即咨询
                </div>
                <!-- <p class="sq_content sq_content_color">
                  {{ list.online_time }}
                </p> -->
              </div>
              <div
                class="sq_html sq_content line_h_26 sq_content_color"
                v-html="list.content"
              ></div>
              <div class="sq_xs">
                <div
                  class="
                    new_footer
                    s_flex s_justify_content_between s_align_items_center
                    sq_content sq_content_color
                    ft_weight_400
                  "
                >
                  <div @click="prev">上一篇</div>
                  <div @click="next">下一篇</div>
                </div>
              </div>
            </div>
          </section>
          <div class="leftMenu sq_xl">
            <ul class="s_flex s_flex-column s_justify_content_center">
              <li class="sq_content sq_tilte_color" @click="prev">上一篇</li>
              <li class="sq_content sq_tilte_color" @click="next">下一篇</li>
            </ul>
          </div>
        </div>
      </div>
    </div>
    <Footer />
    <rightMenu @moveTo="moveTo" />

    <signUp
      :dialogVisible="dialogVisible"
      @handleClose="handleClose"
      @submit="submit"
      :type="type"
      :text="text"
    />
  </div>
</template>

<script>
import Header_h from "@/components/Header_h";
import Footer from "@/components/Footer";
import bannerInfo from "@/components/web/bannerInfo";
import leftMenu from "@/components/web/leftMenu";
import { knowledgeInfo } from "@/api/web";
import rightMenu from "@/components/web/rightMenu";
import signUp from "@/components/web/signUp";
import { PAGE_BASE_URL } from "@/config";
import { consultAdd } from "@/api/web";
export default {
  components: {
    Header_h,
    Footer,
    bannerInfo,
    leftMenu,
    rightMenu,
    signUp,
  },
  data() {
    return {
      dialogVisible: false,
      url: "",
      text: {
        title: "咨询",
        btn: "提交",
        textVlaue: "",
      },
      type: 7,
      list: [],
      banner: [],
      info: {
        title: "知识产权金融",
        content: "专利保险/维权，知识产权质押融资专项服务",
        img: require("@/assets/web/banner1.png"),
      },
      check: -1,
      active: 2,
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    async handleClose() {
      this.dialogVisible = false;
    },
    async submit(form) {
      try {
        await consultAdd({ ...form, from: this.url });
        this.$message.success("提交成功");
      } catch (error) {
        this.$message.error(error.message);
      }
      this.dialogVisible = false;
    },
    getUrl() {
      // 点击专利保险
      this.dialogVisible = true;
      this.text.textVlaue = ` 请填写您的联系方式，我们工作人员将尽快与您联系，将为您提供“${this.list.title}”相关咨询服务。`;
    },
    moveTo() {
      window.scrollTo(0, 0);
    },
    async getList() {
      try {
        this.list = await knowledgeInfo({ knowledge_id: this.$route.query.id });
      } catch (error) {
        this.$message.error(error.message);
      }
    },
    checkItem(index) {
      this.active = index;
    },
    async prev() {
      if (this.list.prev) {
        try {
          this.list = await knowledgeInfo({ knowledge_id: this.list.prev });
        } catch (error) {
          this.$message.error(error.message);
        }
      } else {
        this.$message.success("暂无数据");
      }
    },
    async next() {
      if (this.list.next) {
        try {
          this.list = await knowledgeInfo({ knowledge_id: this.list.next });
        } catch (error) {
          this.$message.error(error.message);
        }
      } else {
        this.$message.success("暂无数据");
      }
    },
  },
};
</script>

<style lang="less" scoped>
/* core_content */
.new_box {
  margin-top: -4%;
  position: relative;
  z-index: 1;
  margin-bottom: 60px;
}
.core_content .item_list_img {
  width: 240px;
  object-fit: cover;
  overflow: hidden;
  .img_wap {
    padding-bottom: 56%;
    width: 100%;
    position: relative;
    img {
      width: 100%;
      transition: all 0.5s ease;
      &:hover {
        transform: scale(1.1);
      }
    }
  }
}

.li_active {
  width: 100%;
  background: #ffffff;
  box-shadow: 0 0 16px rgba(24, 76, 171, 0.16);
  border: none;
}

.right_info {
  width: 70%;
  margin-left: 25px;
}

.core_content .item_list {
  border-bottom: 1px solid #eee;
  padding: 23px 15px;
  width: 100%;
  margin-bottom: 30px;
  background: #ffffff;
  border: 1px solid #ced4ea;
  cursor: pointer;
  transition: all 0.2s ease;
}

.content_spacing {
  margin: 22px auto 25px;
}
.core_content_left {
  width: 90%;
  //   margin-left: 60px;
  background-color: #fff;
  height: 100%;
  box-shadow: 0px 0px 21px 0px rgba(97, 97, 102, 0.23);
  padding: 30px;
  // margin-bottom:25px;
}
.core_content_right {
  width: 25%;
  background-color: #fff;
}
.content_right_spacing {
  margin: 10px 0;
}
.list_right {
  border-top: 1px solid #eee;
  padding: 10px 0;
  margin: 0 10px;
}
.right_title {
  margin: 0 10px;
  padding: 10px 0;
}

.sq_h3 {
  margin-bottom: 30px;
}

.sq_html {
  border-top: 1px solid var(--color9);
  border-bottom: 1px solid var(--color9);
  padding: 30px 0;
  margin-top: 25px;
  /deep/ img {
    // width: 100%;
    margin: 30px 0;
  }
}

.new_footer {
  margin-top: 45px;
  div:hover {
    color: var(--color);
    cursor: pointer;
  }
  .iconfont {
    font-size: 12px;
  }
}

.leftMenu {
  width: 213px;
  padding: 20px 0;
  background: #fff;
  box-shadow: 0px 0px 21px 0px rgba(97, 97, 102, 0.23);
  margin-left: 60px;
  text-align: center;
  ul {
    width: 100%;
    height: 100%;
    text-align: center;
    li {
      padding: 0 15px;
      cursor: pointer;
      margin-top: 28px;
      &:first-child {
        margin-top: 0;
      }
    }
  }
}

/* core_content */

@media (max-width: 750px) {
  .core_content .item_list_img {
    width: 100%;
    height: 127px;
    margin-right: 0;
    margin-bottom: 20px;
  }
  .core_content_left {
    width: 100%;
    background-color: #fff;
    height: 100%;
  }
  .core_content {
    padding: 20px 0;
  }
}
</style>

